﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MvcControlsToolkit
{
    public class TitleOptions: BaseObject
    {
        private string rendererOptions
        {
            get { return Attributes["rendererOptions"]; }
            set { Attributes["rendererOptions"] = value; }
        }

        /// <summary>
        /// Text of the title
        /// </summary>
        public string Text
        {
            get { return GetString("text"); }
            set { SetString("text", value); }
        }

        /// <summary>
        /// Wether to display the title on the graph
        /// </summary>
        public bool Show
        {
            get
            {
                if (Attributes.ContainsKey("show"))
                    return Boolean.Parse(GetString("show"));
                else
                    return true;
            }

            set
            {
                Attributes["show"] = value.ToString().ToLower();
            }
        }

        /// <summary>
        /// Renderer specific options passed to the renderer
        /// </summary>
        /// <param name="rendererOptions"></param>
        /// <returns></returns>
        public TitleOptions SetRendererOptions(PieRendererOptions rendererOptions)
        {
            this.rendererOptions = rendererOptions.ToString();

            return this;
        }
    }
}
